/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#include <cubefs/core/api/api.hpp>

#define CUBEFS_SOURCE "cubefs/core/api-impl/all/metadata.hpp:" CUBEFS_AT

namespace cubefs { namespace api {

CUBEFS_DEFINE_REFLECTION_TYPE(Page, 				PageImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(Metadata, 			MetadataImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(MetadataGroup, 		MetadataGroupImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(FieldMetadata, 		FieldMetadataImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(BitmapField,			BitmapFieldImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(FlagField,			FlagFieldImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(NumberField,			NumberFieldImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(IDField,				IDFieldImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(PageMetadata, 		PageMetadataImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(ModelMetadata, 		ModelMetadataImpl);
CUBEFS_DEFINE_REFLECTION_TYPE(ContainerMetadata,	ContainerMetadataImpl);

template <typename T>
Type* TypedField<T>::MyType() {
	return TypedFieldImpl<T>::MyType();
}

void InitMetadataTypes() {

    PageImpl::Init();

    MetadataImpl::Init();
    MetadataGroupImpl::Init();
    FieldMetadataImpl::Init();

    BitmapFieldImpl::Init();
    FlagFieldImpl::Init();

    NumberFieldImpl::Init();

    TypedFieldImpl<Byte>::Init();
    TypedFieldImpl<UByte>::Init();
    TypedFieldImpl<Short>::Init();
    TypedFieldImpl<UShort>::Init();
    TypedFieldImpl<Int>::Init();
    TypedFieldImpl<UInt>::Init();
    TypedFieldImpl<BigInt>::Init();

    IDFieldImpl::Init();

    PageMetadataImpl::Init();
    ModelMetadataImpl::Init();
    ContainerMetadataImpl::Init();
}

}}

#undef CUBEFS_SOURCE
